package test5

object TestInputChufang {
  def main(args: Array[String]): Unit = {
    println("输入一个商品：")
    var str:String=null;
    var str2:Null=null;
    val s = scala.io.StdIn.readLine();
    val result=s match {
      case "salt"=>println("调料");
      case "xiyi"=>println("家电");
      case "shouji"=>println("数码产品");
      case _=>println("不知道！");
    }
    ///println(result);
    def matchTest(x:Int):String={
      x match {
        case 1=>return "one"
        case 2=>return "two"
        case i if i<=10 => "duo"
        case _=> "many"
      }
    }
    println(matchTest(-22))
    println(matchTest(1))
    println(matchTest(10))
    println(matchTest(22))

  }
}
